<?php
require_once('menu.php');
echo $javascript->link('mootools.js');
?>
<script type="text/javascript">
<!--
    Window.onDomReady(function(){ new Accordion($$('.panel h3.jpane-toggler'), $$('.panel div.jpane-slider'), {onActive: function(toggler, i) { toggler.addClass('jpane-toggler-down'); toggler.removeClass('jpane-toggler'); },onBackground: function(toggler, i) { toggler.addClass('jpane-toggler'); toggler.removeClass('jpane-toggler-down'); },duration: 300,opacity: false}); });
-->
</script>
<form name="adminForm" method="post" action="<?=$html->url('/admin/index')?>">
<table width="100%" class="menubar" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="menudottedline" width="40%">
            <div class="pathway"></div>
        </td>
        <td class="menudottedline" align="right">
            <table cellpadding="0" cellspacing="0" border="0" id="toolbar">
                <tr height="60" valign="middle" align="center">
                    <td>
                        <a class="toolbar" href="#">
                        <?php echo $html->image('admin/help_f2.png', array('align' => 'middle', 'border' => 0)); ?><br>Help
                        </a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br>
<br>
<div align="center" class="centermain">
    <div class="main">
        <table class="adminheading">
            <tr>
                <th class="cpanel" rowspan="2" nowrap>Control Panel</th>
            </tr>
        </table>

        <table class="adminform">
            <tr>
                <td width="90%" valign="top">
                    <div id="content-pane" class="pane-sliders">
                        <div class="panel">
                            <h3 class="jpane-toggler title" id="cpanel-panel">
                                <p align="left" style="margin: 0px;"><span>About Control Panel</span></p>
                            </h3>
                            <div class="jpane-slider content">
                                <div style="padding: 5px">
                                    <p align="left">
                                        Welcome to the business owners administrator panel.  After logging in you have the ability to:<br/>
                                        Change your password, update your address, modify your graphics or make other changes to your listing.
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="content-pane" class="pane-sliders">
                        <div class="panel">
                            <h3 class="jpane-toggler title" id="cpanel-panel">
                                <p align="left" style="margin: 0px;"><span>Message Board&nbsp;(<?=$msg_count?>)</span></p>
                            </h3>
                            <div class="jpane-slider content">
                                <div style="padding: 5px">
                                    <table width="100%" cellpadding=4 bgcolor="#ffffff" class="adminlist">
                                    <?php
                                     if ($messages) {
                                        foreach ($messages as $idx => $m) {
                                            $color = ($idx/2 == round($idx/2)) ? "row0" : "row1";
                                     ?>
                                        <tr class="<?=$color?>">
                                            <td>
                                                <table width="100%">
                                                    <tr>
                                                        <td>From:&nbsp;<?=$m['Message']['name']?>&nbsp;(<i><?=$m['Message']['email']?></i>)</td>
                                                    </tr>
                                                    <tr>
                                                        <td>Date:&nbsp;<?=$m['Message']['date_created']?></td>
                                                    </tr>
                                                    <tr>
                                                        <td nowrap bgcolor="#fdfcf0"><?=$m['Message']['body']?></td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    <?php
                                         }
                                     ?>
                                        <tr>
                                            <td><?php if (isset($paging)) { echo $this->renderElement('pagination', $paging); } ?></td>
                                        </tr>
                                    <?php
                                     }
                                     ?>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </td>
                <?php
                 if ($group_id == 2) {
                 ?>
                <td width="10%" valign="top">
                    <div id="cpanel">
                        <div style="float: right">
                            <div class="icon">
                                <a class="toolbar" href="javascript: document.getElementById('flag').value='uprofile'; document.adminForm.submit();">
                                <?php echo $html->image('admin/user.png', array('align' => 'middle', 'border' => 0)); ?><br>User Profile
                                </a>
                            </div>
                        </div>
                        <div style="float: right">
                            <div class="icon">
                                <a class="toolbar" href="javascript: document.getElementById('flag').value='bprofile'; document.adminForm.submit();">
                                <?php echo $html->image('admin/systeminfo.png', array('align' => 'middle', 'border' => 0)); ?><br>Business Profile
                                </a>
                            </div>
                        </div>
                    </div>
                </td>
                <?php
                 }
                 ?>
            </tr>
        </table>
    </div>
</div>
<input type="hidden" id="flag" name="flag">
</form>
